function updateTime() {
    const now = new Date();
    const timeString = now.toLocaleTimeString();
    const hour = now.getHours();
    let greeting;
    if (hour >= 5 && hour < 12) {
        greeting = '又是新的一天呢';
    } else if (hour >= 22 && hour < 5) {
        greeting = '时间不早了，该休息了';
    } else if (hour >= 12 && hour < 18) {
        greeting = '下午好！';
    }else {
        greeting = '你好呀';
    }
    document.getElementById('time').textContent = timeString;
    document.getElementById('greeting').textContent = ` ${greeting}`;
}
setInterval(updateTime, 1000);
updateTime(); // 初始化时间显示